package com.the_ring.chapter08.application;

import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;

public class MyApplication extends Application {

    String channelName = "";
    String channelId = "";

    @Override
    public void onCreate() {
        super.onCreate();

        // 从系统服务中获取通知管理器
        NotificationManager notifyMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        // 创建指定编号、指定名称、指定级别的通知渠道
        NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT);
        // 创建指定的通知渠道
        notifyMgr.createNotificationChannel(channel);
    }
}
